<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="sosr.serveur.IServeurRMI"%>
<%@page import="sosr.bean.Patient"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.ArrayList"%>
<jsp:useBean id="logon" scope="session" class="bean.Connexion"></jsp:useBean>
<%

String q = request.getParameter("q");
q = q.toLowerCase();

if (!q.isEmpty()) {
	IServeurRMI serv = logon.getSrvRMI();
	serv.open();
	ArrayList<Patient> ar = serv.listPatient();
	Iterator<Patient> it = ar.iterator();
	while (it.hasNext()) {
		Patient m = it.next();
		String nom = m.getNom().toLowerCase();
		String prenom = m.getPrenom().toLowerCase();
		if (nom.startsWith(q) || prenom.startsWith(q)) {
			out.print(m.getCivilite()+" "+m.getPrenom()+" "+m.getNom()+"|"+m.getIdPatient()+"\n");
		}
	}
	serv.close();
} 
%>